<?php
session_start();
include_once 'functions/function.php';
include_once 'functions/newForum.class.php';
$Db = Db();
if(!isset($_SESSION['id'])){
    header('Location : index.php');
}
if(isset($_POST['title'])){   
   $newForum = new newForum($_POST['title']);
   $error = $newForum->check();
    if($error == "ok"){    
        if($newForum->add()){
            header('Location: home.php?forumTitle='.$_POST['title']);
        }
        else{
            $error = "Sorry, There was a problem adding your Forum";
            $display = $error; 
        }
    }
    else{
        $display = $error;   
    }   
}
?>

<html>
    <!--Create the profile css-->
    <body style="background: url(images/background.jpg);">
       <div id="wrapper">
		
            <div id="head">
		<table id="myTable" border=0>
                    <tr>
                    <td class="leftCell" ><span>Hello!! <span class="newAccount"><?php echo $_SESSION['username']; ?></a></span></td>
                    <td class="middleCell" ><a class="newAccount" href="home.php">Home</a></td>
                    <!--Add a profile class?-->
                    <td class="rightCell" ><span><a class="newAccount" href="logOut.php">Sign out</a></span></td>
                    </tr>
		</table>
            </div> 
           
           <!--What follows is just a basic layout to get an idea of things.-->
           <div id="profileArea">
               <table id="profileTable" border="2"><!--setting border for visualization-->
                   <tr><h2>[USER]'S PROFILE PAGE</h2></tr>
                   <tr><td width='30%'><h1>Name: </h1></td> <td>[First Name] [Last Name]<td></tr>
                   <tr><td width='30%'>Email: </td><td>user@spsu.edu</td></tr>
                   <tr><td width='30%'>Birthday: </td><td width='30%'>8/15/1992</td>
                       <td width='20%'>Age: </td><td width='20%'>21</td></tr>
                   <tr><td width='30%'><h1>Groups: </h1><br>
                           Create Group<br>
                           Manage Groups</td>
                       <td>Group 1<br>Cookies!!!!!!!!!</td></tr>
                   <tr><h2>Recent Activity: </h2></tr><br>
               <tr><td width='33%'>I love cookies and.....</td><td width='33%'>Cookies awesome</td><td width='33%'>3/30/14</td></tr>
               </table>
           </div>
    </body>
</html>